<template>
	<view class="cardBox" >
		<view class="flex" style="margin-top: 10rpx;">
			<view class="biao" style="width: 100%;display: flex;">
				<span class="biao_span">|</span> 
				<text class="cardTitle">{{text.order_info}} </text> 
				<view class="jiantou" style="height: auto;line-height: unset; font-weight: 500;position: relative;z-index: 33;" @click="details(order.orderInfo)">
					>
				</view>
			</view>
		</view>
		
		<view class="flex" style="margin-top: 10rpx;margin-bottom: 10rpx;padding-top: 20rpx;">
			<image :src="img" class="order_img" ></image>
			<view class="order_list" style="width: 70%;margin-top: -2px;">
				<view class="order_name" v-if="lang=='zh'" :class="lang=='ru'?'ru_text':''">{{order.orderJoin.product?order.orderJoin.product:order.orderInfo.release_info.goods_name}}</view>
				<view class="order_name" v-else :class="lang=='ru'?'ru_text':''">{{order.orderJoin.product_ru?order.orderJoin.product_ru:order.orderInfo.release_info.goods_name_ru}}</view>
				<view style="margin-top: 0rpx;" class="flex">
					
					<block  v-if="order.orderInfo.type=='goods'||(order.orderInfo.type=='transport'&&order.orderInfo.release_info.release_type==1)">
						<view style="width: 57%;" v-if="lang=='zh'">
							{{order.orderJoin.num||''}}{{order.orderJoin.number_unit||''}}
						</view>
						<view style="width: 57%;" v-else>
							{{order.orderJoin.num||''}}{{$t(order.orderJoin.number_unit_ru||'')}}
						</view>
					</block>
					<block  v-else-if="order.orderInfo.type=='transport'&&(order.orderInfo.release_info.release_type==2||(order.orderInfo.release_info.release_type==3&&order.orderInfo.release_info.human_type==1))">
						<view style="width: 57%;" v-if="lang=='zh'">
							{{order.orderInfo.release_info.goods_num||''}}{{order.orderInfo.release_info.number_unit||''}}
						</view>
						<view style="width: 57%;" v-else>
							{{order.orderInfo.release_info.goods_num||''}}{{$t(order.orderInfo.release_info.number_unit_ru||'')}}
						</view>
					</block>
					<block  v-else>
						<view style="width: 57%;" v-if="lang=='zh'">
							{{order.orderInfo.release_info.goods_num||''}}{{order.orderInfo.release_info.number_unit||''}}
						</view>
						<view style="width: 57%;" v-else>
							{{order.orderInfo.release_info.goods_num||''}}{{$t(order.orderInfo.release_info.number_unit_ru||'')}}
						</view>
					</block>
					<view class="order_info_btn orange" @click="detailsp(order.orderInfo)" v-if="order.orderInfo.type!='transport'" style="position: relative;z-index: 33;">
						{{text.order_info_btn}}
					</view>
				</view>
			</view>
		</view>
		
		<!--交易总价-->
		<view class="order_trade">
			<view style="width: 70%;text-align: left;font-size: 24rpx;" v-if="order.orderJoin.type=='goods'">{{text.trade||''}}</view>
			<view style="width: 70%;text-align: left;font-size: 24rpx;" v-else-if="order.orderJoin.type=='transport'">{{$t("运费总价")}}</view>
			<view style="width: 70%;text-align: left;font-size: 24rpx;" v-else-if="order.orderJoin.type=='crossborder'">{{$t("费用总价")}}</view>
			<view style="width: 30%;text-align: right;font-size: 24rpx;">{{order.orderJoin.zj_price||''}}{{$t(order.orderJoin.price_unit||'')}}</view>
		</view>
		
		<view class="order_trade" v-if="order.orderJoin.type=='transport'">
			<view style="width: 70%;text-align: left;font-size: 24rpx;">{{$t("整车/散货")}}</view>
			<view style="width: 30%;text-align: right;font-size: 24rpx;">{{$t(order.orderInfo.release_info.whole_diffuse.text)}}</view>
		</view>
		
	</view>
</template>

<script>
	import {HTTP_REQUEST_URL,HTTP_IMG_UTL,IMAGE_URL} from "@/config/app";
	
	export default {
		components: {
			
		},
		props:{
			order:{
				type: [Array,Object],
				default:{}
			}
		},
		data() {
			return {
				//远程域名
				HTTP_IMG_UTL,
				HTTP_REQUEST_URL,
				IMAGE_URL,
				url: IMAGE_URL,
				
				//语言
				lang: this.$i18n.locale,
				//文字
				text:{			
					order_info:this.$t('订单信息'),
					order_info_btn:this.$t('查看商品详情'),
					trade:this.$t('交易总价'),
				},
				//订单信息
				order_info:{
					img:HTTP_IMG_UTL+'huangjin.png',
					name:'商品名称',
					num:"100",
					num_unit:"箱",
					price:100000,
					price_unit:'元'
				},
				img:'',
			}
		},
		mounted() {
			var res = this.order
			var img = ''
			if(res.orderInfo.type=='goods'){
				if((res.orderJoin.logo)&&(res.orderJoin.logo.length!=0)){
					img = res.orderJoin.logo[0].url
				}
				if(img==''){
					if((res.orderJoin.images)&&(res.orderJoin.images.length!=0)){
						img = res.orderJoin.images[0].url
					}
				}
			}else if(res.orderInfo.type=='transport'){
				if(res.orderInfo.release_info.release_type==1||(res.orderInfo.release_info.release_type==3&&res.orderInfo.release_info.human_type==2)){
					if((res.orderJoin.images)&&(res.orderJoin.images.length!=0)){
						img = res.orderJoin.images[0].url
					}
				}
				if(res.orderInfo.release_info.release_type==2||(res.orderInfo.release_info.release_type==3&&res.orderInfo.release_info.human_type==1)){
					if((res.orderInfo.release_info.images)&&(res.orderInfo.release_info.images.length!=0)){
						img = res.orderInfo.release_info.images[0].url
					}
				}
			}else if(res.orderInfo.type=='crossborder'){
				if((res.orderInfo.release_info.logo)&&(res.orderInfo.release_info.logo.length!=0)){
					img = res.orderInfo.release_info.logo[0].url
				}
				if(img==''){
					if((res.orderInfo.release_info.images)&&(res.orderInfo.release_info.images.length!=0)){
						img = res.orderInfo.release_info.images[0].url
					}
				}
			}
			this.img = img
		},
		methods:{
			details(i) {
				// console.log(i);
				this.$u.route({
					url: "/pages/ordering/orderInfo",
					params: {
						id: i.id,
						releaseType:i.type,
						type:i.release_info.type,
					}
				})
			},
			detailsp(i) {
				// console.log(i);
				// this.$u.route({
				// 	url: "/pages/order/process/cooperate",
				// 	params: {
				// 		order_id: i.id,
				// 		join_order_id:i.join_order_id
				// 	}
				// })
				this.$u.route({
					url: "/pages/index/detail/detail",
					params: {
						id: i.release_info.id,
						flag:1,
						// type: this.current + 1,
						type: i.release_info.type,
						releaseType: i.type,
					}
				})
			},
		}
	}
</script>

<style lang="scss" >
	@import "@/common/orderDetail.scss";
	.ru_text{ width: 95% !important; line-height: 25rpx !important; }
	
</style>